home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Grab Bag
/
Shareware Grab Bag.iso
/
001
/
piblist.arc
/
READCOMM.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1985-03-24
|
6KB
|
174 lines
(*---------------------------------------------------------------------------*)
(* Read_Command --- Read PibList command line *)
(*---------------------------------------------------------------------------*)
PROCEDURE Read_Command;
(*---------------------------------------------------------------------------*)
(* *)
(* Routine: Read_Command *)
(* *)
(* Purpose: Read PibList command line *)
(* *)
(* Calling Sequence: *)
(* *)
(* Read_Command; *)
(* *)
(* Calls: *)
(* *)
(* TextColor *)
(* KeyPressed *)
(* *)
(* Called By: Prompt *)
(* *)
(* Remarks: *)
(* *)
(* Reads the command Line into the string "command". *)
(* A nul character is appended to terminate the string. *)
(* On exit Cind = 1. *)
(* *)
(*---------------------------------------------------------------------------*)
LABEL
1;
VAR
c: CHAR;
BEGIN (* Read_Command *)
1: Textcolor( Spec_Chars_Color );
One_Up := FALSE;
One_Down := FALSE;
Cind := 0;
(* Read first character of command *)
READ( Kbd , c );
(* If escape, convert escape sequence *)
(* letter command. *)
IF ( c = ^[ ) AND KeyPressed THEN
BEGIN
READ( Kbd , c );
Case ORD(c) OF
119,
71: BEGIN
Command[1] := 'S';
Command[2] := '1';
Cind := 2;
END;
117,
79: BEGIN
Command[1] := 'S';
Command[2] := '9';
Command[3] := '9';
Command[4] := '9';
Command[5] := '9';
Command[6] := '9';
Command[7] := '9';
Command[8] := '9';
Command[9] := '9';
Cind := 9;
END;
73: BEGIN
Command[1] := '-';
Command[2] := 'S';
Cind := 2;
END;
81: BEGIN
Command[1] := '+';
Command[2] := 'S';
Cind := 2;
END;
75: BEGIN
Command[1] := '-';
Command[2] := '1';
Command[3] := '0';
Command[4] := 'C';
Cind := 4;
END;
77: BEGIN
Command[1] := '+';
Command[2] := '1';
Command[3] := '0';
Command[4] := 'C';
Cind := 4;
END;
72: BEGIN
Command[1] := '-';
Command[2] := 'L';
Cind := 2;
One_Up := TRUE;
END;
80: BEGIN
Command[1] := '+';
Command[2] := 'L';
Cind := 2;
One_Down := TRUE;
END;
118: BEGIN
Command[1] := '+';
Command[2] := 'P';
Cind := 2;
END;
132: BEGIN
Command[1] := '-';
Command[2] := 'P';
Cind := 2;
END;
END (* Case *);
END (* BEGIN Esc *)
ELSE (* Else pick up letter command *)
BEGIN
WHILE ( C <> CR ) AND ( Cind < Max_String-1 ) DO
BEGIN
IF c = ctrlx THEN
BEGIN
WRITE(' *** DELETED');
WRITEln;
GOTO 1;
END
ELSE IF c = bs THEN
IF Cind > 0 THEN
BEGIN
Cind := Cind - 1;
WRITE(bs,' ',bs);
END
ELSE
ELSE
BEGIN
Cind := Cind + 1;
Command[Cind] := c;
WRITE( CON , c );
END;
READ( Kbd , c );
END;
END;
(* Insert NUL as last char in command *)
Command[ Cind + 1 ] := NUL;
Cind := 1;
Textcolor( ForeGround_Color );
END (* Read_Command *);